CRITICAL: 3
};
-function _fixMarkup(text, allowMarkup) {
- if (allowMarkup) {
- // Support &, ", ', < and >, escape all other
- // occurrences of '&'.
- let _text = text.replace(/&(?!amp;|quot;|apos;|lt;|gt;)/g, '&');
-
- // Support <b>, <i>, and <u>, escape anything else
- // so it displays as raw markup.
- _text = _text.replace(/<(?!\/?[biu]>)/g, '<');
-
- try {
- Pango.parse_markup(_text, -1, '');
- return _text;
- } catch (e) {}
- }
-
- // !allowMarkup, or invalid markup
- return GLib.markup_escape_text(text, -1);
-}
-
const FocusGrabber = new Lang.Class({
Name: 'FocusGrabber',
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-// Test cases for MessageTray markup parsing
+// Test cases for Calendar markup parsing
const JsUnit = imports.jsUnit;
const Pango = imports.gi.Pango;
const Environment = imports.ui.environment;
Environment.init();
-const MessageTray = imports.ui.messageTray;
+const Calendar = imports.ui.calendar;
// Assert that @input, assumed to be markup, gets "fixed" to @output,
// which is valid markup. If @output is null, @input is expected to
function assertConverts(input, output) {
if (!output)
output = input;
- let fixed = MessageTray._fixMarkup(input, true);
+ let fixed = Calendar._fixMarkup(input, true);
JsUnit.assertEquals(output, fixed);
let parsed = false;
// Assert that @input, assumed to be plain text, gets escaped to @output,
// which is valid markup.
function assertEscapes(input, output) {
- let fixed = MessageTray._fixMarkup(input, false);
+ let fixed = Calendar._fixMarkup(input, false);
JsUnit.assertEquals(output, fixed);
let parsed = false;